package com.rednose.videoplayer.utils;

import static android.content.Context.MODE_PRIVATE;

import android.content.Context;
import android.content.SharedPreferences;

public abstract class Utility {


    public static String hashPassword(String password) {
        // 简单的哈希函数示例，实际应用中请使用更安全的哈希算法
        return Integer.toString(password.hashCode());
    }

    //把毫秒单位转化为时分秒
    public static String timeConversion(Long millie){
        if (millie != null) {
            long seconds = (millie / 1000);
            long sec = seconds % 60;
            long min = (seconds / 60) % 60;
            long hrs = (seconds / (60 * 60)) % 24;
            if (hrs > 0) {
                return String.format("%02d:%02d:%02d", hrs, min, sec);
            } else {
                return String.format("%02d:%02d", min, sec);
            }
        } else {
            return null;
        }
    }
    public static String getCurrentUser(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("user_info", MODE_PRIVATE);
        return preferences.getString("username", "");
    }

}